package zack.gateway.center.domain.message.service;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import zack.gateway.center.application.IMessageService;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * @author A1793
 */
@Service
public class MessageService implements IMessageService {

    @Value("122.51.38.***")
    String host;

    @Value("16379")
    Integer port;

    @Resource
    Publisher publisher;

    /**
     *
     * @return
     */
    @Override
    public Map<String, String> queryRedisConfig() {
        return new HashMap<String, String>() {{
            put("host", host);
            put("port", String.valueOf(port));
        }};
    }

    @Override
    public void pushMessage(String gatewayId, Object message) {
        publisher.pushMessage(gatewayId, message);
    }
}
